#ifndef ATTACK_H
#define ATTACK_H

#include <stdio.h>
#include <gmp.h>
#include <openssl/sha.h>

#define hLen SHA_DIGEST_LENGTH

typedef struct
{
  char *oracle_path;
  char *challenge_path;
  char *program_name;
} Options;

typedef struct
{
  mpz_t n;
  mpz_t e;
  mpz_t c;
} Challenge;

typedef unsigned char Byte;

Options parse_args(int, char **);
void usage(char *);
Challenge parse_challenge(char *);

int send_to_oracle(char *, Challenge);

void calculate_b(mpz_t, Challenge);

void step_1(mpz_t, Options, Challenge);
void step_2(mpz_t, mpz_t, mpz_t, Options, Challenge);
void step_3(mpz_t, mpz_t, mpz_t, Options, Challenge);

int h2int(char);
char *i2osp(mpz_t, int);

char *eme_oaep_decode(char *, size_t);

void print_bytes(Byte *, size_t);
Byte *MGF1(Byte *, const size_t, const size_t);

char *strdup(const char *);
#endif

